<?php

//获取会员信息
$sql = "select * from `hy_member` where `user_id`='".$_SESSION['user_id']."'";
$objDb->query($sql);
$memberData = $objDb->get_data();

?>
<table width="630" border="0" align="center" cellpadding="0" cellspacing="0"  style="font-size:12px; ">
        <tbody>
          <tr>
            <td valign="top" align="middle" width="16">　</td>
            <td width="630" valign="top">
			
			
		   <table width="636" border="0" cellspacing="1" cellpadding="0" bgcolor="#999999"  style="line-height:22px;">
					<tr>
					  <td bgcolor="#F3F3F3" align="left" colspan="5"> 购物流程: 查看购物车 > 登录注册 > 填写核对订单信息 > 生成提交订单</td>
					</tr>
					<tr  bgcolor="#CCCCCC"  height="30" align="center">
					  <td width="12%"><strong>产品序号</strong></td>
					  <td width="33%"><strong>产品名称</strong></td>
					  <td width="19%"><strong>兑换所需积分</strong></td>
					  <td width="14%"><strong>数量</strong></td>
					  <td width="22%"><strong>小计积分</strong></td>
					</tr>
                <?php 
				//读取购物车商品
				$sql="select * from hy_b_car where memberID='".$_SESSION["user_id"]."' ";
				$objDb->query($sql);
				$row = $objDb->get_data();
				$i = 1;
				$money = 0 ;
				if(is_array($row)){
				   foreach($row as $key => $value){
				      $newmoneys[] = $value['money'];
				?>
					<tr bgcolor="#FFFFFF"  align="center">
					  <td><?=$i?></td>
					  <td><?=$value['productName']?></td>
					  <td>￥<?=$value['price']?></td>
					  <td><?=$value['buyNum']?></td>
					  <td>￥ <?=$value['money']?></td>
					</tr>
                <?php 	
               
						 $i++;
					 }
					 ?>
					 <tr><td colspan="5" align="right" bgcolor="#FFFFFF">总积分：&nbsp;<b><?php echo array_sum($newmoneys);?></b>&nbsp;积分点</td></tr>
					 <?php 
				}  
				?>
					
              </table>
                <h1 style="font-size:18px;">
		        <?php
				    $sql = "select * from hy_member where user_id='".$_SESSION["user_id"]."'";
					$objDb->query($sql);
					$daterow = $objDb->get_data();
					echo "当前可用积分 <span style=\"font-family:'黑体'; font-size:18px; font-weight:bold; color:#FF0000;\">".$daterow[0]['zhifen']."</span>点,";
					      $castmoney =  array_sum($newmoneys);
	                      if($daterow[0]['zhifen']> $castmoney){
						       echo "祝您购物愉快!"; 
							} else {
							   echo "您的余额不足，请及时充值!";
							   echo "&nbsp;&nbsp; <a href='dzf.php'><span style=\"font-family:'黑体'; font-size:18px; font-weight:bold; color:#FF0000;\">快速充值</span></a>";
							}
					
				?>            
                </h1>
             
				
				
                <p><span style="font-family:'黑体'; font-size:16px; font-weight:bold; color:#FF0000;"><Br/>
                请确认您的信息是否正确，如有错误请马上修改,确认支付不可更改！</span>
                    <form action="buy_pay.php" method="post"  onSubmit="return checkFrm(this)" >	
                  <input type="hidden" id="totalzhifen" name="totalzhifen" value="<?=$money?>"			/>
                  <input type="hidden" id="action" name="action" value="buy_pay"			/>
                </p>
                <h5>收货人信息</h5>
                    <table width="698" border="0" cellspacing="1" cellpadding="0">
                      <tr valign="middle" height="30">
                        <td width="155">收货人姓名:</td>
                        <td width="187"><input type="text" name="memberName" id="memberName" value="<?=$memberData[0]['user_name']?>" /> *</td>
                        <td width="153">电子邮件地址:</td>
                        <td width="227"><input type="text" name="Email" id="Email" value="<?=$memberData[0]['user_email']?>" />*</td>
                      </tr>
                      <tr valign="middle" height="30">
                        <td width="155">详细地址:</td>
                        <td width="187"><input type="text" name="Address" id="Address" value="<?=$memberData[0]['user_add']?>" />*</td>
                        <td width="153">邮政编码:</td>
                        <td width="227"><input type="text" name="PostCode" id="PostCode" value="<?=$memberData[0]['user_zipcode']?>" /> *</td>
                      </tr>
                      <tr valign="middle" height="30">
                        <td width="155">电话:</td>
                        <td width="187"><input type="text" name="TEL" id="TEL" value="<?=$memberData[0]['user_tel']?>" />*</td>
                        <td width="153">手机:</td>
                        <td width="227"><input type="text" name="Phone" id="Phone" value="<?=$memberData[0]['user_mobile']?>" />*</td>
                      </tr>
                      <tr valign="middle" height="30">
                        <td width="155">最佳送货时间:</td>
                        <td width="187"><input type="text" name="SendTime" id="SendTime" value="" /> *</td>
                        <td width="153"></td>
                      </tr>
                    </table>
                    
                  
                      <input name="SendTypeName" id="SendTypeName" type="hidden" value="<?=$strSendTypeName?>" />
                      <input name="SendTypeMoney" id="SendTypeMoney" type="hidden" value="<?=$fltSendMoney?>" />
            </table>
                    <h5>其他信息</h5>
                    <table width="698" border="0" cellspacing="0" cellpadding="0">
                      
                      <tr valign="middle" height="30">
                        <td>订单附言：</td>
                        <td align="left"><textarea cols="60" rows="4"  name="Message" id="Message"></textarea></td>
                      </tr>
                      <tr>
                        <td> 验证码 ：</td>
                        <td  align="left"  width="518"><input name="yancode" id="yancode" size="6" maxlength="6" />
                        <a href="#" onClick="this.firstChild.src='./admin/seccode.php?update=' + Math.random();return false;"><img align="absmiddle" src="./admin/seccode.php?update=<?php echo time(); ?>" border="0" /></a></td>
                      </tr>
                      <tr>
                        <td colspan="2" align="center"><input value="确认兑换" name="" type="submit" /></td>
                      </tr>
                    </table>
                </form>
			  </td>
          </tr>
        </tbody>
      </table>
	  
	  <script type="text/javascript">
<!--

function checkFrm(dom){
	if(dom.memberName.value == ""){
		alert('请输入收货人姓名');
		dom.memberName.focus();
		return false;
	} else if(dom.Email.value == ""){
		alert('请输入收货人Email');
		dom.Email.focus();
		return false;
	} else if(dom.Address.value == ""){
		alert('请输入收货人地址');
		dom.Address.focus();
		return false;
	} else if(dom.PostCode.value == ""){
		alert('请输入收货人邮政编码');
		dom.PostCode.focus();
		return false;
	} else if(dom.TEL.value == ""){
		alert('请输入收货人电话');
		dom.TEL.focus();
		return false;
	} else if(dom.Phone.value == ""){
		alert('请输入收货人手机');
		dom.Phone.focus();
		return false;
	} else if(dom.SendTime.value == ""){
		alert('请输入最佳送货时间');
		dom.SendTime.focus();
		return false;
	} else if(dom.yancode.value == ""){
		alert('请输入验证码');
		dom.yancode.focus();
		return false;
	} else {
		return true;
	}
}

function changeSend(TypeName,Money){
	document.getElementById("SendTypeName").value = TypeName;
	document.getElementById("SendTypeMoney").value = Money;
}

function changePay(TypeName){
	document.getElementById("PayTypeName").value = TypeName;
}

function openinvoice(){
    document.getElementById("invoice").style.display = '';
}

function closeinvoice(){
    document.getElementById("invoice").style.display = 'none';
}
-->

</script>